<template>
  <div class="about-master-container" v-loading="loading">
    <base-breadcrumb>
      <a-form-model ref="form1" :model="dels" :rules="rules1">

        <!--        设计月报信息-->
        <a-card :bordered="false" style="margin-bottom: 20px">
          <title-name title="设计月报信息" />
          <a-row>
            <a-col span="8">
              <a-form-model-item label="项目名称">
                <BaseInput v-model="dels.projectName" placeholder="" disabled />
              </a-form-model-item>
            </a-col>
            <a-col span="8">
              <a-form-model-item label="项目设计管理类别">
                <BaseInput v-model="dels.designTypeName" placeholder="" disabled />
              </a-form-model-item>
            </a-col>
            <a-col span="8">
              <a-form-model-item label="项目设计优化指标(万)" prop="optimizeTarget">
                <BaseInput v-model="dels.optimizeTarget" :disabled="disabled" placeholder="请输入" />
              </a-form-model-item>
            </a-col>
            <a-col span="8">
              <a-form-model-item label="填写人">
                <BaseInput v-model="dels.fillPerson" disabled />
              </a-form-model-item>
            </a-col>
            <a-col span="8">
              <a-form-model-item label="填写日期">
                <BaseInput v-model="dels.modifiedTime" disabled />
              </a-form-model-item>
            </a-col>
            <a-col span="8" style="position: relative;">
              <a-form-model-item label="是否上报设计策划书">
                <a-radio-group v-model="dels.haveDesignBook" disabled>
                  <a-radio :value="1">是</a-radio>
                  <a-radio :value="2">否</a-radio>
               </a-radio-group>
              </a-form-model-item>
              <a-button style="position: absolute;right: 0;top:10px;" @click="visible1 = true">填表说明</a-button>
            </a-col>
          </a-row>
        </a-card>

        <!--        本月设计进度完成情况-->
        <a-card :bordered="false" style="margin-bottom: 20px">
          <title-name :title="$dateFormat(dels.monthlyReportTime,'M_CN') + '设计进度完成情况'" />
          <a-row>
            <a-col span="24">
              <a-form-model-item label="各专业设计进度：" prop="designProgress">
                <BaseTextarea v-model="dels.designProgress" :disabled="disabled" placeholder="请输入" />
              </a-form-model-item>
            </a-col>
            <a-col span="24" v-if="dels.designTypeName === 'A类'">
              <a-form-model-item label="设计报批手续办理进度：" prop="designApprovalProgress">
                <BaseTextarea v-model="dels.designApprovalProgress" :disabled="disabled" placeholder="请输入" />
              </a-form-model-item>
            </a-col>
          </a-row>
        </a-card>

        <!--        本月设计业务管理总结-->
        <a-card :bordered="false" style="margin-bottom: 20px">
          <title-name :title="$dateFormat(dels.monthlyReportTime,'M_CN') + '设计业务管理总结'" />
          <div style="padding-left: 20px;padding-right: 20px;">

            <!--           本月前期立项落地实施（包含方案优化） -->
            <template>
              <title-name size="14" title="本月前期立项落地实施（包含方案优化）" />
              <a-row>
                <a-col span="8">
                  <a-form-model-item label="本月实施项：">
                    <BaseInput v-model="dels.designBusinessSummaryVO.currentMonthImplementNum" placeholder=""
                               disabled
                    />
                  </a-form-model-item>
                </a-col>
                <a-col span="8">
                  <a-form-model-item label="本月实施金额：">
                    <BaseInput v-model="dels.designBusinessSummaryVO.currentMonthImplementMoney	" placeholder=""
                               disabled
                    />
                  </a-form-model-item>
                </a-col>
              </a-row>
              <a-row>
                <a-col span="8">
                  <a-form-model-item label="累计实施项：">
                    <BaseInput v-model="dels.designBusinessSummaryVO.accumulativeImplementNum	" placeholder=""
                               disabled
                    />
                  </a-form-model-item>
                </a-col>
                <a-col span="8">
                  <a-form-model-item label="累计实施金额">
                    <BaseInput v-model="dels.designBusinessSummaryVO.accumulativeImplementMoney	" placeholder=""
                               disabled
                    />
                  </a-form-model-item>
                </a-col>
              </a-row>
              <a-table
                :pagination="false"
                bordered
                :columns="columns1"
                :data-source="dels.designBusinessSummaryVO.doubleOptimizationImplementationList"
              >
                <span slot="serial" slot-scope="text, record, index">{{ index + 1 }}</span>
              </a-table>
            </template>

            <!--            本月新增立项（包含方案优化）-->
            <template>
              <title-name size="14" title="本月新增立项（包含方案优化）" class="marginTop" />
              <a-row>
                <a-col span="8">
                  <a-form-model-item label="本月新增项：">
                    <BaseInput v-model="dels.schemeOptimizationVO.currentMonthAddNum" placeholder="" disabled />
                  </a-form-model-item>
                </a-col>
                <a-col span="8">
                  <a-form-model-item label="本月新增金额：">
                    <BaseInput v-model="dels.schemeOptimizationVO.currentMonthAddMoney" placeholder="" disabled />
                  </a-form-model-item>
                </a-col>
              </a-row>
              <a-row>
                <a-col span="8">
                  <a-form-model-item label="累计总立项：">
                    <BaseInput v-model="dels.schemeOptimizationVO.accumulativeAddNum" placeholder="" disabled />
                  </a-form-model-item>
                </a-col>
                <a-col span="8">
                  <a-form-model-item label="累计总立项金额：">
                    <BaseInput v-model="dels.schemeOptimizationVO.accumulativeAddMoney" disabled placeholder="输入合同范围" />
                  </a-form-model-item>
                </a-col>
              </a-row>
              <a-table
                :pagination="false"
                bordered
                :columns="columns2"
                :data-source="dels.schemeOptimizationVO.doubleOptimizationProjectList"
              >
                <span slot="serial" slot-scope="text, record, index">{{ index + 1 }}</span>
              </a-table>
            </template>

            <!--            本月设计例会召开-->
            <template v-if="false">
              <title-name size="14" title="本月设计例会召开" class="marginTop" />
              <a-row>
                <a-col span="8">
                  <a-form-model-item label="本月召开例会：">
                    <BaseInput v-model="dels.designMeetingVO.currentMonthMeetingNum" placeholder="" disabled />
                  </a-form-model-item>
                </a-col>
                <a-col span="8">
                  <a-form-model-item label="累计召开例会：">
                    <BaseInput v-model="dels.designMeetingVO.accumulativeMeetingNum" placeholder="" disabled />
                  </a-form-model-item>
                </a-col>
              </a-row>
              <a-table
                :pagination="false"
                bordered
                :columns="columns3"
                :data-source="dels.designMeetingVO.meetingList"
              >
                <span slot="serial" slot-scope="text, record, index">{{ index + 1 }}</span>
                <template slot="fileInfoVO" slot-scope="text, record, index">
                  <file-link :file-list="record.fileInfoVO" />
                </template>
              </a-table>
            </template>

            <!--            设计变更管理-->
            <template>
              <title-name size="14" title="设计变更管理" class="marginTop" />
              <a-row>
                <a-col span="8">
                  <a-form-model-item label="本月变更数(份)：">
                    <BaseInput v-model="dels.designChangeVO.currentMonthChangeNum" placeholder="" disabled />
                  </a-form-model-item>
                </a-col>
                <a-col span="8">
                  <a-form-model-item label="累计变更数(份)：">
                    <BaseInput v-model="dels.designChangeVO.accumulativeChangeNum" placeholder="" disabled />
                  </a-form-model-item>
                </a-col>
              </a-row>
              <a-table
                :pagination="false"
                bordered
                :columns="columns4"
                :data-source="dels.designChangeVO.changeList"
              >
                <span slot="serial" slot-scope="text, record, index">{{ index + 1 }}</span>
              </a-table>
            </template>

            <!--            深化设计成果管理-->
            <template v-if="fasle">
              <title-name size="14" title="深化设计成果管理" class="marginTop" />
              <a-row>
                <a-col span="8">
                  <a-form-model-item label="本月深化设计(项)：">
                    <BaseInput v-model="dels.designResultsVO.currentMonthDesignResultsNum" placeholder="" disabled />
                  </a-form-model-item>
                </a-col>
                <a-col span="8">
                  <a-form-model-item label="累计深化设计(项)：">
                    <BaseInput v-model="dels.designResultsVO.accumulativeDesignResultsNum" placeholder="" disabled />
                  </a-form-model-item>
                </a-col>
              </a-row>
              <a-table
                ref="table"
                :pagination="false"
                bordered
                :columns="columns5"
                :data-source="dels.designResultsVO.resultsList"
              >
                <span slot="serial" slot-scope="text, record, index">{{ index + 1 }}</span>
                <div slot="action" slot-scope="text, record, index">
                  <a v-if="(!disabled) && (!record.completeProgress)" @click="editForm2(record)">编辑</a>
                </div>
              </a-table>
            </template>

            <!--            工程洽商联系单管理-->
            <template v-if="false">
              <title-name size="14" title="工程洽商联系单管理" class="marginTop" />
              <a-row>
                <a-col span="8">
                  <a-form-model-item label="本月洽商联系单(份)：">
                    <BaseInput v-model="dels.designContactVO.currentMonthContactNum" placeholder="" disabled />
                  </a-form-model-item>
                </a-col>
                <a-col span="8">
                  <a-form-model-item label="累计洽商联系单(份)：">
                    <BaseInput v-model="dels.designContactVO.accumulativeContactNum" placeholder="" disabled />
                  </a-form-model-item>
                </a-col>
              </a-row>
              <div class="table-operator">
                <a-button v-if="!disabled" type="primary" @click="visible3 = true">新增工程洽商联系单</a-button>
              </div>
              <a-table
                ref="table6"
                :pagination="false"
                bordered
                :columns="columns6"
                :data-source="dels.designContactVO.designRegardingContactList"
              >
                <span slot="serial" slot-scope="text, record, index">{{ index + 1 }}</span>
                <div v-if="!disabled" slot="action" slot-scope="text, record, index">
                  <a @click="handleDels3(record.id)">删除</a>
                </div>
              </a-table>
            </template>
          </div>
        </a-card>

        <!--        本月招采计划完成情况（A类项目填写）-->
        <a-card :bordered="false" style="margin-bottom: 20px" v-if="dels.designTypeName === 'A类'">
          <title-name :title="$dateFormat(dels.monthlyReportTime,'M_CN') + '招采计划完成情况（A类项目填写）'" />
          <a-row>
            <a-col span="24">
              <a-form-model-item label="土建部分：" prop="civilPart">
                <BaseTextarea v-model="dels.civilPart" :disabled="disabled" placeholder="请输入" />
              </a-form-model-item>
            </a-col>
            <a-col span="24">
              <a-form-model-item label="机电安装：" prop="electrical">
                <BaseTextarea v-model="dels.electrical" :disabled="disabled" placeholder="请输入" />
              </a-form-model-item>
            </a-col>
            <a-col span="24">
              <a-form-model-item label="其他专业：" prop="otherSpecialty">
                <BaseTextarea v-model="dels.otherSpecialty" :disabled="disabled" placeholder="请输入" />
              </a-form-model-item>
            </a-col>
          </a-row>
        </a-card>

        <!--        当月设计管理工作计划-->
        <a-card :bordered="false" style="margin-bottom: 20px">
          <title-name title="当月设计管理工作计划" class="marginTop" />
          <div class="table-operator">
            <a-button v-if="!disabled" type="primary" @click="visible4 = true">
              新增工作计划
            </a-button>
          </div>
          <a-table
            ref="table7"
            :pagination="false"
            bordered
            :columns="columns7"
            :data-source="dels.designNextMonthWorkPlanList"
          >
            <span slot="serial" slot-scope="text, record, index">{{ index + 1 }}</span>
            <div slot="action" slot-scope="text, record, index">
              <a v-if="!disabled" @click="handleDels4(record.id)">删除</a>
            </div>
          </a-table>
        </a-card>

        <div style="float:right;margin-bottom: 20px;" class="page-btn-right-top">
          <template v-if="!disabled">
            <a-button type="primary" style="margin-right: 20px;" @click="submit(0)">保存草稿</a-button>
            <a-button type="primary" :loading="loading" style="margin-right: 20px;" @click="submit(1)">提交</a-button>
          </template>
          <a-button @click="$close">关闭</a-button>
        </div>
      </a-form-model>

      <!--填表说明-->
      <a-modal
        width="700px"
        :visible.sync="visible1"
        :title="'填表说明'"
        @cancel="visible1=false"
      >
        <template slot="footer">
          <a-button key="back" @click="visible1=false">关闭</a-button>
        </template>
        <div>填表说明：</div>
        <div>1、 设计管理月报以项目为单位上报，上报内容应涵盖土建与安装专业。</div>
        <div>2、 项目设计优化指标，按局里要求合同额*X%（EPC项目为*%，其他项目为*%，合同额原则上为自施合同额）来计算，按已完成指标按立项审批金额填写。</div>
        <div>3、 为便于双优化数据统计，第二条1、2项中，方案优化同设计优化一并上报。</div>
        <div>4、 设计进度主要考虑关键出图节点和按时完成情况。</div>
        <div>5、 前期策划本月完成项填写当月完成的前期设计策划书中的策划内容。</div>
        <div>6、 本月新增设计策划项是指策划书以外本月新增的策划内容。</div>
        <div>7、 设计变更管理应填写非我方主动策划、优化的变更内容。</div>
        <div>8、 深化设计管理落实到责任人，方便后期问责和管理。</div>
        <div>9、 施工图设计优化管理应填写在设计出具第一版正式蓝图后的新增优化内容。</div>
        <div>10、本月招采请购计划完成情况主要填写涉及到设计图纸的内容。</div>
        <div>11、填表人由专职（兼职）设计经理填写、项目经理审核签字。</div>
      </a-modal>

      <!--编辑深化设计成果-->
      <a-modal
        width="900px"
        :visible="visible2"
        :title="'编辑深化设计成果'"
        @cancel="visible2=false"
      >
        <template slot="footer">
          <a-button key="back" @click="cancel()">取消</a-button>
          <a-button key="submit" :loading="loading" type="primary" @click="handleOks2">提交</a-button>
        </template>
        <div class="about-master-container">
          <a-form-model ref="form2" :model="form2" :rules="rules2">
            <a-row>
              <a-col span="12">
                <a-form-model-item label="完成进度" prop="completeProgress">
                  <BaseInput v-model="form2.completeProgress" type="text" placeholder="请输入完成进度" />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row>
              <a-col span="24">
                <a-form-model-item label="情况说明">
                  <BaseTextarea v-model="form2.informationNote" placeholder="请输入情况说明" />
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-form-model>
        </div>
      </a-modal>

      <!--新增工程洽商联系单-->
      <a-modal
        width="900px"
        :visible="visible3"
        :title="'新增工程洽商联系单'"
        @cancel="visible3=false"
      >
        <template slot="footer">
          <a-button key="back" @click="cancel()">取消</a-button>
          <a-button key="submit" :loading="loading" type="primary" @click="handleOks3">确定新增</a-button>
        </template>
        <div class="about-master-container">
          <a-form-model ref="form3" :model="form3" :rules="rules3">
            <a-row>
              <a-col span="24">
                <a-form-model-item label="洽商内容" prop="content">
                  <BaseInput v-model="form3.content" type="text" placeholder="请输入" />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row>
              <a-col span="12">
                <a-form-model-item label="预估(实施)效益(万)" prop="forecastBenefit">
                  <BaseInputNumber v-model="form3.forecastBenefit" type="text" placeholder="请输入" />
                </a-form-model-item>
              </a-col>
              <a-col span="12">
                <a-form-model-item label="完成时间" prop="completeTime">
                  <a-date-picker v-model="form3.completeTime" style="width: 100%" @change="onChangeDown" />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row>
              <a-col span="24">
                <a-form-model-item label="情况说明">
                  <BaseTextarea v-model="form3.informationNote" placeholder="请输入情况说明" />
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-form-model>
        </div>
      </a-modal>

      <!--新增当月设计管理工作计划-->
      <a-modal
        class="normal-modal"
        :visible="visible4"
        :title="'新增当月设计管理工作计划'"
        @cancel="visible4 = false"
      >
        <template slot="footer">
          <a-button key="back" @click="cancel()">取消</a-button>
          <a-button key="submit" :loading="loading" type="primary" @click="handleOks4">确定新增</a-button>
        </template>
        <div class="about-master-container">
          <a-form-model ref="form4" :model="form4" :rules="rules4">
            <a-row>
              <a-col span="24">
                <a-form-model-item label="计划内容" prop="planContent">
                  <BaseInput v-model="form4.planContent" type="text" />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row>
              <a-col span="12">
                <a-form-model-item label="计划完成时间" prop="planCompleteTime">
                  <a-date-picker v-model="form4.planCompleteTime" style="width: 100%" @change="onChangeDown" />
                </a-form-model-item>
              </a-col>
            </a-row>
            <a-row>
              <a-col span="24">
                <a-form-model-item label="需要公司解决的问题" prop="problem">
                  <BaseTextarea v-model="form4.problem" placeholder="请输入需要公司解决的问题" />
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-form-model>
        </div>
      </a-modal>
      <selectApprover :businessId="businessId"  :processConfig="setProcessConfig"></selectApprover>
    </base-breadcrumb>
  </div>
</template>

<script>
import {
  getMonthlyReportOne,
  updateByPrimaryKeySelective,
  deleteNextMonthWorkPlan,
  insertNextMonthWorkPlan,
  insertRegardingContact,
  deleteRegardingContact, updateRegardingContact, updateDeepenResults, addDeepenResults
} from '@/api/design/monthlyReport/monthlyReport'
import { deleteProjects } from '@/api/project/projects'
import { workApplication } from '@/api/project/stopWork'

export default {
  name: 'a' + Date.now(),
  props: {
    isAudit: {
      type: Boolean,
      defalut: false
    }
  },
  data() {
    let disabled = this.$route.query.type == 'view' || this.isAudit
    let columns5 = [
      { title: '序号', width: 70, scopedSlots: { customRender: 'serial' } },
      { title: '深化设计成果内容', width: 300, dataIndex: 'resultsContent' },
      { title: '深化设计类型', width: 150, dataIndex: 'designTypeName' },
      { title: '责任人', width: 150, dataIndex: 'responsible' },
      { title: '完成进度', width: 150, dataIndex: 'completeProgress' },
      { title: '情况说明', dataIndex: 'situationExplain' }
    ]
    let columns6 = [
      { title: '序号', width: 70, scopedSlots: { customRender: 'serial' } },
      { title: '洽商内容', width: 300, dataIndex: 'content' },
      { title: '预估(实施)效益(万)', width: 150, dataIndex: 'forecastBenefit' },
      { title: '完成时间', width: 150, dataIndex: 'completeTime' },
      { title: '情况说明', dataIndex: 'informationNote' }
    ]
    let columns7 = [
      { title: '序号', width: 70, scopedSlots: { customRender: 'serial' } },
      { title: '计划内容', width: 300, dataIndex: 'planContent' },
      { title: '计划完成时间', width: 150, dataIndex: 'planCompleteTime' },
      { title: '需要公司解决的问题', dataIndex: 'problem' }
    ]
    if (!disabled) {
      columns5.push({ title: '操作', dataIndex: 'action', width: '150px', scopedSlots: { customRender: 'action' } })
      columns6.push({ title: '操作', dataIndex: 'action', width: '150px', scopedSlots: { customRender: 'action' } })
      columns7.push({ title: '操作', dataIndex: 'action', width: '150px', scopedSlots: { customRender: 'action' } })
    }
    return {
      disabled, // 当前类型（编辑edit、查看view、审批approve）
      columns1: [
        { title: '序号', scopedSlots: { customRender: 'serial' } },
        { title: '实施项名称', dataIndex: 'implementationName' },
        { title: '优化类型', dataIndex: 'optimizeTypeName' },
        { title: '立项效益(万元)', dataIndex: 'projectBenefits' },
        { title: '完成效益(万元)', dataIndex: 'completeBenefits' },
        // { title: '当前状态', dataIndex: 'currentStatus' }
      ],
      columns2: [
        { title: '序号', scopedSlots: { customRender: 'serial' } },
        { title: '立项内容', dataIndex: 'projectContent' },
        { title: '优化类型', dataIndex: 'optimizeTypeName' },
        { title: '立项效益(工期、质量)(万元)', dataIndex: 'projectBenefits' },
        { title: '预计实施日期', dataIndex: 'expectImplementTime' },
        { title: '责任人', dataIndex: 'responsible' }
      ],
      columns3: [
        { title: '序号', scopedSlots: { customRender: 'serial' } },
        { title: '例会内容', dataIndex: 'meetingContent' },
        { title: '召开时间', dataIndex: 'convokeTime' },
        { title: '例会成果', dataIndex: 'meetingResults' },
        { title: '附件', dataIndex: 'fileInfoVO', scopedSlots: { customRender: 'fileInfoVO' } }
      ],
      columns4: [
        { title: '序号', scopedSlots: { customRender: 'serial' } },
        { title: '变更内容', dataIndex: 'changeContent' },
        { title: '变更原因', dataIndex: 'changeReason' },
        { title: '预估效益', dataIndex: 'estimateBenefits' },
        { title: '实施情况', dataIndex: 'implementSituation' }
      ],
      columns5,
      columns6,
      columns7,
      visible1: false, //填表说明
      visible4: false,    // 工作计划
      visible2: false,  // 深化设计内容
      visible3: false,  // 洽商联系单

      loading: false,
      loading1: false,  // 提交
      loading2: false,
      loading3: false,
      loading4: false,

      form1: {},
      form2: {},
      form3: {},
      form4: {},

      rules1: {
        optimizeTarget: [{ required: true, message: '请输入项目优化指标(万)', trigger: 'blur' }],
        designProgress: [{ required: true, message: '请输入各专业设计进度', trigger: 'blur' }],
        designApprovalProgress: [{ required: true, message: '请输入设计报批手续办理进度', trigger: 'blur' }],
        civilPart: [{ required: true, message: '请输入土建部分', trigger: 'blur' }],
        electrical: [{ required: true, message: '请输入机电安装', trigger: 'blur' }],
        otherSpecialty: [{ required: true, message: '请输入其他专业', trigger: 'blur' }]
      },

      rules2: {
        completeProgress: [{ required: true, message: '请输入完成进度', trigger: 'blur' }]
      },
      rules3: {
        content: [{ required: true, message: '请输入洽商内容', trigger: 'blur' }],
        forecastBenefit: [{ required: true, message: '请输入预估实施效益(万)', trigger: 'blur' }],
        completeTime: [{ required: true, message: '请输入完成时间', trigger: 'change' }]
      },
      rules4: {
        planContent: [{ required: true, message: '请输入计划内容', trigger: 'blur' }],
        planCompleteTime: [{ required: true, message: '请输入计划完成时间', trigger: 'change' }]
      },

      id: '', // 设计月报id
      dels: {// 详情数据
        creater: JSON.parse(sessionStorage.getItem('ycloud-user_info')).name,
        createTime: this.getNowDate(),
        fillPerson: JSON.parse(sessionStorage.getItem('ycloud-user_info')).name,
        modifiedTime: this.getNowDate(),
        designBusinessSummaryVO: {},//本月设计业务总结
        schemeOptimizationVO: {},//本月设计业务总结
        designMeetingVO: {},//本月设计例会召开
        designChangeVO: {},//设计变更管理
        designResultsVO: {},//深化设计成果管理
        designContactVO: {},//工程洽商联系单管理,
        monthlyReportTime: Date.now()
      },
      tableData: [], // 表格数据
      //获取流程配置值
      processConfig: null,
      //点击提交发送流程配置值
      setProcessConfig: null,
      businessId: null
    }
  },
 async created() {
    this.id = this.$route.query.id
    // this.id = '1417407549245886461'
    this.getData()
    //获取通过获取流程配置值
    this.processConfig = await this.$getConfigFn('project_design_monthly_report')
  },
  methods: {
    cancel() {
      this.visible2 = false
      this.visible3 = false
      this.visible4 = false
      this.form2 = {}
      this.form3 = {}
      this.form4 = {}
      this.$refs.form2 && this.$refs.form2.clearValidate()
      this.$refs.form3 && this.$refs.form3.clearValidate()
      this.$refs.form4 && this.$refs.form4.clearValidate()
    },
    // 查询详情
    async getData(isReturn) {
      this.loading = true
      let res = await getMonthlyReportOne({ id: this.id })
      this.loading = false
      if (res.code === this.SUCCESS_CODE) {
        if (isReturn) {
          return res.data
        } else {
          this.dels = this.$assign(this.dels, res.data)
          this.dels.haveDesignBook = this.dels.haveDesignBook?1:2;
          if (!this.dels.fillPerson) this.dels.fillPerson = JSON.parse(sessionStorage.getItem('ycloud-user_info')).name
          if (!this.dels.modifiedTime) this.dels.modifiedTime = this.getNowDate()
          if (!this.dels.designBusinessSummaryVO) this.dels.designBusinessSummaryVO = {}
          if (!this.dels.schemeOptimizationVO) this.dels.schemeOptimizationVO = {}
          if (!this.dels.designMeetingVO) this.dels.designMeetingVO = {}
          if (!this.dels.designChangeVO) this.dels.designChangeVO = {}
          if (!this.dels.designResultsVO) this.dels.designResultsVO = {}
          if (!this.dels.designContactVO) this.dels.designContactVO = {}
        }
      }
      return null
    },
    handleOks2() {
      // return this.add()
      this.$refs.form2.validate(async (err, value) => {
        if (err) {
          this.loading = true
          this.form2.monthlyReportId = this.dels.id
          let res = await updateDeepenResults({}, this.form2)
          this.loading = true
          if (res.code === this.SUCCESS_CODE) {
            let res1 = await this.getData(true)
            if (res1) {
              this.dels['designResultsVO']['resultsList'] = res1['designResultsVO']['resultsList']
            }
            this.cancel()
            this.$message.success('编辑成功！')
          }
        }
      })
    },
    editForm2(row) {
      this.form2 = this.$clone(row)
      this.form2.informationNote = row.situationExplain
      this.visible2 = true
    },
    // 新增工程洽商联系单
    handleOks3() {
      this.$refs.form3.validate(async (err, value) => {
        if (err) {
          this.loading = true
          this.form3.monthlyReportId = this.dels.id
          let res = await insertRegardingContact({}, this.form3)
          this.loading = true
          if (res.code === this.SUCCESS_CODE) {
            let res1 = await this.getData(true)
            if (res1) {
              this.dels['designContactVO']['designRegardingContactList'] = res1['designContactVO']['designRegardingContactList']
              this.dels['designContactVO']['currentMonthContactNum'] = res1['designContactVO']['currentMonthContactNum']
              this.dels['designContactVO']['accumulativeContactNum'] = res1['designContactVO']['accumulativeContactNum']
            }
            this.cancel()
            this.$message.success('新增成功！')
          }
        }
      })
    },
    // 删除工程洽商联系单
    handleDels3(id) {
      this.$submitConfirm(async () => {
        this.loading = true
        let res = await deleteRegardingContact({ id })
        this.loading = false
        if (res.code === this.SUCCESS_CODE) {
          let res1 = await this.getData(true)
          if (res1) {
            this.dels['designContactVO']['designRegardingContactList'] = res1['designContactVO']['designRegardingContactList']
            this.dels['designContactVO']['currentMonthContactNum'] = res1['designContactVO']['currentMonthContactNum']
            this.dels['designContactVO']['accumulativeContactNum'] = res1['designContactVO']['accumulativeContactNum']
          }
          this.$message.success('删除成功！')
        }
      }, '确定删除工程洽商联系单吗?')
    },
    // 新增当月设计管理工作计划
    handleOks4() {
      this.$refs.form4.validate(async (err, value) => {
        if (err) {
          this.loading = true
          this.form4.monthlyReportId = this.dels.id
          let res = await insertNextMonthWorkPlan({}, this.form4)
          this.loading = false
          if (res.code === this.SUCCESS_CODE) {
            let res1 = await this.getData(true)
            if (res1) {
              this.dels['designNextMonthWorkPlanList'] = res1['designNextMonthWorkPlanList']
            }
            this.cancel()
            this.$message.success('新增工作计划成功！')
          }
        }
      })
    },
    // 删除当月设计管理工作计划
    handleDels4(id) {
      this.$submitConfirm(async () => {
        this.loading = true
        let res = await deleteNextMonthWorkPlan({ id })
        this.loading = false
        if (res.code === this.SUCCESS_CODE) {
          let res1 = await this.getData(true)
          if (res1) {
            this.dels['designNextMonthWorkPlanList'] = res1['designNextMonthWorkPlanList']
          }
          this.$message.success('删除成功！')
        }
      }, '确定删除工作计划吗?')
    },
    // 提交
    submit(status) {
      this.setProcessConfig = null; 
      this.$refs.form1.validate(async (err, value) => {
        if (err) {
          this.loading = true
          this.dels.fillStatus = status
          this.submitApprovalConfirm(status==1?this.processConfig:6, async (flag)=>{
            if(!flag) {
              this.loading = false
              return
            }
          this.dels.haveDesignBook = this.dels.haveDesignBook*1===1?true:false;
          let res = await updateByPrimaryKeySelective({}, this.dels)
          this.loading = false
          if (res.code === this.SUCCESS_CODE) {
            this.$noticeSuccess('操作成功！')
            if(status*1 === 1) {
            //提交时，返回id
                this.businessId = this.id;
                this.setProcessConfig = this.processConfig;
                return
            }else{
              this.$close()
          }
          }
          })
        } else {
          this.$noticeWarning('请填写完整')
        }
      })
    },
    onChangeDown() {
    }
  }
}
</script>